/**
 * ...
 * @author Krzysztof Rozalski
 */

package hapi.util.benchmark.test;
import hapi.util.benchmark.BenchmarkRunner;
import hapi.util.benchmark.FunctionBenchmark;

class DivMult {

	static inline var ITERATIONS_NUM = 10000000;
	
	public static function perform(runner:BenchmarkRunner) {
		var f1 = function() {
			for( i in 0...ITERATIONS_NUM ) {
				var a = i/4;
				var b = i/10;
				var c = i/1000;
			}
		}
		var f2 = function() {
			for( i in 0...ITERATIONS_NUM ) {
				var a = i*0.25;
				var b = i*0.1;
				var c = i*0.001;
			}
		}
		var f3 = function() {
			for( i in 0...ITERATIONS_NUM ) {
				var a:Int = Std.int(i * 0.25);
				var b:Int = Std.int(i * 0.1);
				var c:Int = Std.int(i * 0.001);
			}
		}
		runner.add(new FunctionBenchmark("div", f1, 1));
		runner.add(new FunctionBenchmark("mult", f2, 1));
		runner.add(new FunctionBenchmark("mult-int", f3, 1));
	}
}